<template>
	<view class="content">
		<view class="user">
			<!-- <image class="user_back" src="/static/distribution.png" mode="widthFix"></image> -->
			<!-- <view class="share">
				<view class="title">分享好友</view>
				<view style="width: 118rpx;height: 1rpx; background-color: #A0A0A0; margin:0 auto 40rpx;"></view>
				<view class="text">扫描或长按保存二维码推荐给好友</view>
				<view style="display: flex;">
					<image :show-menu-by-longpress="true" :src="code"></image>
				</view>
			</view> -->
			<view class="team_client">
				<view class="team" @click="team">
					<text>我的团队</text>
					<image src="/static/02.png"></image>
				</view>
				<view class="client" @click="connection">
					<text>我的客户</text>
					<image src="/static/01.png"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const request = require('../../utils/request');
	export default {
		data() {
			return {
				code: ''
			}
		},
		onLoad() {
			// this.getCode();
		},
		methods: {
			// 获取分销二维码
			getCode(){
				let that = this;
				var formData = {
					user_token:uni.getStorageSync('user_token'),
				};
				//网络请求
				request('/api/v1/index/get_code', 'POST', formData).then((res) => {
					console.log(res.data.data)
					if(res.data.code == 0){
						that.code = res.data.data;
					}else{
						uni.showToast({
							title:res.data.msg,
							icon:'none'
						});
					}
				});
			},
			onPreserve(){
				let that = this
				uni.downloadFile({
					url: that.code,
					success: res => {
						if (res.statusCode === 200) {
							uni.saveImageToPhotosAlbum({
								filePath: res.tempFilePath,
								success: function() {
									uni.showToast({
										title: '保存成功',
										duration: 2000
									})
								}
							})
						}
					},
					fail: err => {
						console.log(err)
					}
				})
			},
			team(){
				uni.navigateTo({
					url:'/pages/my/teams'
				})
			},
			connection(){
				uni.navigateTo({
					url:'/pages/my/connection'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.user{
		position: relative;
		.user_back{
			width: 100%;
		}
		.share{
			background-color: #fff;
			margin: -100rpx 36rpx 0;
			box-shadow: -1rpx 2rpx 24rpx 0rpx rgba(144,144,144,0.36);
			position: relative;
			padding-bottom: 60rpx;
			border-radius: 10rpx;
			.title{
				font-size: 40rpx;
				font-family: FZZDHJW;
				font-weight: normal;
				color: #282828;
				line-height: 40rpx;
				padding: 74rpx 0 38rpx;
				text-align: center;
			}
			.text{
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #999999;
				line-height: 26rpx;
				text-align: center;
				margin-bottom: 60rpx;
			}
			image{
				width: 332rpx;
				height: 332rpx;
				margin: 0 auto 20rpx;
			}
			.button{
				margin: 0 178rpx 0;
				height: 80rpx;
				border-radius: 50rpx;
				background-color: #38c763;
				display: flex;
				align-items: center;
				justify-content: center;
				view{
					color: #fff;
				}
			}
		}
		.team_client{
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin: 80rpx 36rpx 0;
			.team, .client{
				width: 38%;
				height: 106rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 0 30rpx;
				border-radius: 20rpx;
				text{
					color: #000;
					font-weight: 600;
					font-size: 28rpx;
				}
				image{
					width: 70rpx;
					height: 60rpx;
				}
			}
			.team{
				background-color: #e7f7ea;
			}
			.client{
				background-color: #fff2e2;
			}
		}
	}
</style>
